package cn.yunhe.model;

import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;

@Entity(name = "学生")
@Table(name = "student11")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Student implements Serializable {
    private int sid;
    private String sname;
    private int sage;
    private Class sclass;

    public Student() {
    }

    public Student(int sid, String sname, int sage) {
        this.sid = sid;
        this.sname = sname;
        this.sage = sage;
    }

    public Student(String sname, int sage, Class sclass) {
        this.sname = sname;
        this.sage = sage;
        this.sclass = sclass;
    }

    public Student(int sid, String sname, int sage, Class sclass) {
        this.sid = sid;
        this.sname = sname;
        this.sage = sage;
        this.sclass = sclass;
    }

    @Id
    @GeneratedValue
    @Column(name = "sid")
    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    @Column(name = "sname")
    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    @Column(name = "sage")
    public int getSage() {
        return sage;
    }

    public void setSage(int sage) {
        this.sage = sage;
    }

    @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "scid")
    public Class getSclass() {
        return sclass;
    }

    public void setSclass(Class sclass) {
        this.sclass = sclass;
    }
}
